﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Calc.aspx.cs" Inherits="DentScan2.WebApp.Calc" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="~/UC/ucRegional.ascx" TagPrefix="uc1" TagName="ucRegional" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function ()
        {
            $('#lStatus').fadeOut(4000, function ()
            {
                $(this).html(""); //reset the label after fadeout
            });
        });

        function ShowHideObs()
        {
            if ($('#dObs')[0].style.display == "none")
                $('#dObs')[0].style.display = "block";
            else
                $('#dObs')[0].style.display = "none";

        }
    </script>
    <asp:UpdatePanel runat="server" ID="upAutoSave">
        <ContentTemplate>
            <asp:Timer runat="server" ID="tAutoSave" Enabled="true" Interval="30000" OnTick="tAutoSave_Tick" />
        </ContentTemplate>
    </asp:UpdatePanel>
    <table>
        <tr>
            <td valign="middle">
                <p class="lbl">Метод на изчисление</p>
            </td>
            <td valign="middle">
                <h2>
                    <asp:Literal runat="server" ID="ltMethodName" />
                </h2>
            </td>
        </tr>
    </table>
    <asp:MultiView runat="server" ID="mvCalc" ActiveViewIndex="0">
        <asp:View runat="server" ID="vTable">
            <table border="1" cellpadding="0" cellspacing="0">
                <tr>
                    <td rowspan="21" width="50%">
                        <%--<asp:ImageMap ID="imCar" runat="server" ImageUrl="~/Img/car/sedan.gif">
                    <asp:PolygonHotSpot HotSpotMode="PostBack" PostBackValue="vzd"
                        Coordinates="279, 245, 286, 270, 290, 323, 170, 320, 164, 278, 163, 268, 191, 253, 193, 253, 195, 252, 199, 252, 201, 251, 203, 251, 205, 250, 209, 250, 211, 249, 217, 249, 219, 248, 225, 248, 227, 247, 235, 247, 237, 246, 254, 246, 256, 245, 279, 245 " />


                    <asp:PolygonHotSpot HotSpotMode="PostBack" PostBackValue="vpd"
                        Coordinates="289, 245, 300, 268, 302, 321, 401, 323, 416, 272, 346, 249, 289, 245" />

                    <asp:PolygonHotSpot HotSpotMode="PostBack" PostBackValue="kpd"
                        Coordinates="621, 254, 621, 273, 624, 304, 556, 318, 554, 308, 551, 300, 547, 293, 542, 287, 536, 283, 529, 279, 522, 278, 514, 277, 507, 278, 500, 280, 493, 283, 487, 288, 481, 294, 477, 301, 474, 309, 473, 319, 469, 319, 465, 320, 450, 320, 447, 321, 412, 321, 427, 263, 469, 258, 475, 258, 480, 259, 492, 259, 497, 260, 538, 260, 543, 259, 555, 259, 561, 258, 621, 254 " />


                    <asp:PolygonHotSpot HotSpotMode="PostBack" PostBackValue="kzd"
                        Coordinates="14, 241, 156, 259, 163, 317, 150, 316, 150, 307, 149, 303, 149, 294, 148, 290, 147, 286, 146, 282, 145, 278, 144, 275, 142, 272, 140, 269, 138, 266, 135, 264, 132, 262, 129, 260, 126, 260, 124, 259, 122, 259, 120, 258, 111, 258, 109, 259, 108, 259, 106, 260, 103, 261, 101, 261, 99, 262, 97, 264, 95, 265, 93, 267, 91, 269, 89, 271, 88, 273, 87, 276, 85, 278, 84, 281, 83, 284, 82, 287, 81, 290, 81, 293, 80, 295, 79, 298, 79, 301, 78, 303, 34, 300, 14, 241 " />

                    <asp:PolygonHotSpot HotSpotMode="PostBack" PostBackValue="kpl"
                        Coordinates="617, 70, 616, 56, 621, 24, 553, 10, 552, 19, 549, 27, 544, 34, 539, 39, 533, 44, 526, 46, 519, 48, 511, 49, 504, 48, 497, 46, 490, 42, 484, 38, 479, 32, 475, 25, 472, 17, 471, 8, 467, 7, 459, 7, 456, 6, 444, 6, 441, 5, 410, 5, 424, 61, 465, 66, 483, 66, 488, 65, 529, 65, 534, 66, 540, 66, 546, 67, 552, 67, 557, 68, 617, 70 " />

                    <asp:PolygonHotSpot HotSpotMode="PostBack" PostBackValue="vzl"
                        Coordinates="278, 80, 285, 55, 289, 2, 169, 5, 164, 47, 162, 57, 191, 72, 192, 72, 194, 73, 196, 73, 198, 74, 202, 74, 204, 75, 208, 75, 210, 76, 214, 76, 216, 77, 222, 77, 224, 78, 232, 78, 234, 79, 249, 79, 251, 80, 278, 80 " />

                    <asp:PolygonHotSpot HotSpotMode="PostBack" PostBackValue="vpl"
                        Coordinates="286, 81, 297, 58, 299, 5, 399, 3, 414, 54, 343, 77, 286, 81 " />

                    <asp:PolygonHotSpot HotSpotMode="PostBack" PostBackValue="kzl"
                        Coordinates="13, 79, 155, 65, 162, 5, 149, 6, 149, 19, 148, 23, 148, 27, 147, 31, 147, 35, 146, 39, 145, 43, 143, 46, 142, 49, 140, 52, 137, 55, 134, 57, 131, 59, 128, 60, 126, 61, 124, 61, 122, 62, 109, 62, 107, 61, 105, 61, 103, 60, 101, 59, 98, 58, 96, 57, 94, 56, 92, 54, 90, 52, 89, 50, 87, 48, 86, 45, 85, 43, 83, 40, 82, 37, 82, 34, 81, 31, 80, 29, 79, 26, 79, 23, 78, 21, 78, 19, 33, 21, 13, 79 " />

                    <asp:PolygonHotSpot HotSpotMode="PostBack" PostBackValue="b"
                        Coordinates="71, 239, 81, 229, 78, 221, 76, 213, 74, 205, 72, 196, 71, 188, 70, 180, 69, 172, 69, 156, 70, 148, 70, 140, 72, 131, 73, 123, 75, 115, 78, 106, 80, 98, 72, 85, 13, 88, 12, 90, 11, 92, 10, 93, 9, 95, 8, 97, 7, 99, 6, 101, 5, 103, 4, 105, 4, 107, 3, 109, 3, 111, 2, 113, 2, 117, 1, 120, 1, 213, 2, 214, 2, 217, 3, 218, 3, 220, 4, 221, 4, 222, 5, 224, 6, 225, 6, 226, 7, 227, 8, 229, 9, 230, 10, 231, 10, 232, 11, 233, 71, 239 " />

                    <asp:PolygonHotSpot HotSpotMode="PostBack" PostBackValue="p"
                        Coordinates="447, 250, 449, 248, 426, 250, 363, 229, 364, 226, 365, 223, 366, 220, 367, 216, 368, 212, 368, 208, 369, 205, 369, 120, 368, 117, 368, 110, 367, 106, 366, 103, 365, 100, 364, 97, 363, 94, 428, 74, 452, 75, 450, 72, 421, 71, 349, 93, 328, 96, 308, 98, 288, 99, 268, 99, 248, 98, 228, 96, 208, 94, 188, 91, 159, 76, 78, 83, 85, 93, 136, 87, 164, 96, 162, 113, 161, 129, 160, 145, 160, 194, 161, 210, 163, 227, 138, 237, 85, 231, 79, 239, 162, 249, 187, 234, 207, 231, 228, 229, 248, 228, 269, 227, 310, 227, 331, 229, 351, 231, 422, 254, 447, 250 " />

                    <asp:PolygonHotSpot HotSpotMode="PostBack" PostBackValue="k"
                        Coordinates="453, 247, 456, 245, 459, 243, 462, 241, 465, 239, 468, 237, 471, 235, 473, 232, 476, 229, 478, 226, 480, 223, 482, 220, 484, 217, 486, 213, 488, 209, 489, 205, 491, 201, 491, 123, 490, 119, 489, 115, 488, 111, 487, 108, 485, 104, 483, 101, 481, 98, 479, 94, 476, 92, 474, 89, 471, 86, 468, 84, 464, 81, 461, 79, 457, 77, 466, 76, 475, 75, 492, 75, 501, 74, 527, 74, 536, 75, 554, 75, 562, 76, 571, 76, 580, 77, 589, 78, 597, 78, 599, 81, 601, 84, 603, 87, 605, 91, 607, 94, 608, 97, 610, 100, 612, 103, 613, 106, 615, 110, 616, 113, 617, 116, 618, 120, 620, 123, 621, 126, 621, 189, 620, 193, 619, 197, 618, 201, 617, 205, 615, 209, 614, 213, 612, 216, 611, 220, 609, 223, 607, 227, 605, 230, 603, 234, 601, 237, 599, 240, 596, 244, 594, 247, 585, 247, 576, 248, 559, 248, 550, 249, 480, 249, 471, 248, 462, 248, 453, 247 " />



                </asp:ImageMap>--%>
                        <table border="0" width="100%">
                            <tr>
                                <td>
                                    <asp:ImageButton runat="server" ID="bZLK" Text="" Width="100px" OnClick="bZLK_Click" ImageUrl="~/Img/car/zlk.png" Height="50px" />

                                </td>
                                <td>
                                    <asp:ImageButton runat="server" ID="bZLV" Text="" Width="100px" OnClick="bZLV_Click" ImageUrl="~/Img/car/zlv.png" Height="50px" />
                                </td>
                                <td>
                                    <asp:ImageButton runat="server" ID="bPLV" Text="" Width="100px" OnClick="bPLV_Click" ImageUrl="~/Img/car/plv.png" Height="50px" />
                                </td>
                                <td>
                                    <asp:ImageButton runat="server" ID="bPLK" Text="" Width="100px" OnClick="bPLK_Click" ImageUrl="~/Img/car/plk.png" Height="50px" />
                                </td>
                            </tr>
                            <tr>
                                <td>&nbsp;
                                </td>
                                <td colspan="2">
                                    <asp:ImageButton runat="server" ID="bLK" Text="" Width="100px" OnClick="bLK_Click" ImageUrl="~/Img/car/LK.png" Height="50px" />
                                </td>
                                <td>&nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:ImageButton runat="server" ID="bB" Text="" Width="100px" OnClick="bB_Click" ImageUrl="~/Img/car/b.png" Height="50px" />
                                </td>
                                <td>
                                    <asp:ImageButton runat="server" ID="bKAS" Text="" Width="50px" OnClick="bKAS_Click" ImageUrl="~/Img/car/KAS.png" Height="50px" />
                                </td>
                                <td>
                                    <asp:ImageButton runat="server" ID="bT" Text="" Width="100px" OnClick="bT_Click" ImageUrl="~/Img/car/T.png" Height="50px" />
                                </td>
                                <td>
                                    <asp:ImageButton runat="server" ID="bK" Text="" Width="100px" OnClick="bK_Click" ImageUrl="~/Img/car/K.png" Height="50px" />
                                </td>
                            </tr>
                            <tr>
                                <td>&nbsp;
                                </td>
                                <td colspan="2">
                                    <asp:ImageButton runat="server" ID="bDK" Text="" Width="100px" OnClick="bDK_Click" ImageUrl="~/Img/car/DK.png" Height="50px" />
                                </td>
                                <td>&nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:ImageButton runat="server" ID="bZDK" Text="" Width="100px" OnClick="bZDK_Click" ImageUrl="~/Img/car/zdk.png" Height="50px" />
                                </td>
                                <td>
                                    <asp:ImageButton runat="server" ID="bZDV" Text="" Width="100px" OnClick="bZDV_Click" ImageUrl="~/Img/car/zdv.png" Height="50px" />
                                </td>
                                <td>
                                    <asp:ImageButton runat="server" ID="bPDV" Text="" Width="100px" OnClick="bPDV_Click" ImageUrl="~/Img/car/pdv.png" Height="50px" />
                                </td>
                                <td>
                                    <asp:ImageButton runat="server" ID="bPDK" Text="" Width="100px" OnClick="bPDK_Click" ImageUrl="~/Img/car/pdk.png" Height="50px" />
                                </td>
                            </tr>
                        </table>
                        <asp:Button ID="bPrev" runat="server" Text="<<" OnClick="bPrev_Click" />
                        <asp:Button ID="bSaveToDB" runat="server" Text="Save" OnClick="bSaveToDB_Click" />
                        <asp:Label ID="lStatus" runat="server" EnableViewState="False" ForeColor="Green" ClientIDMode="Static" Font-Bold="True"></asp:Label>
                        <asp:Panel runat="server" ID="pShowWhenSaved" Visible="false">
                            <asp:HyperLink ID="hlForm" runat="server" Target="_blank">Формуляр</asp:HyperLink>
                            <asp:UpdatePanel runat="server" ID="upMail">
                                <ContentTemplate>
                                    <table>
                                        <tr>
                                            <td>Имейл 1</td>
                                            <td>
                                                <asp:TextBox runat="server" ID="tbToEmail1" /></td>
                                        </tr>
                                        <tr>
                                            <td>Имейл 2</td>
                                            <td>
                                                <asp:TextBox runat="server" ID="tbToEmail2" /></td>
                                        </tr>
                                        <tr>
                                            <td>Имейл 3</td>
                                            <td>
                                                <asp:TextBox runat="server" ID="tbToEmail3" /></td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td>
                                                <asp:Button runat="server" ID="bSend" OnClick="bSend_Click" Text="Изпрати" /></td>
                                        </tr>
                                    </table>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </asp:Panel>
                    </td>
                    <td colspan="2">
                        <asp:ValidationSummary ID="vsMain" runat="server" ValidationGroup="vg" CssClass="failureNotification" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Експертиза номер</p>
                    </td>
                    <td>
                        <h2>
                            <asp:Label runat="server" ID="lDamageIdentifier" />
                        </h2>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Име на техник</p>
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="tbTechName" CssClass="input100Req" />
                        <asp:RequiredFieldValidator ID="rfvTechName" runat="server" ErrorMessage="Моля, въведете име на техник" ControlToValidate="tbTechName" ValidationGroup="vg" Display="None"></asp:RequiredFieldValidator>

                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Телефон</p>
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="tbTechPhone" CssClass="input100" />

                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Дата на съставяне на оценка</p>
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="tbExpertiseDate" MaxLength="10" ToolTip="Формат на дата: дд.мм.гггг" /><asp:Button ID="bExpertiseDate" runat="server" Text=".." />
                        <asp:CalendarExtender ID="ceDamageDate" runat="server" TargetControlID="tbExpertiseDate" PopupButtonID="bExpertiseDate"
                            DaysModeTitleFormat="dd.MM.yyyy" FirstDayOfWeek="Monday" Format="dd.MM.yyyy"
                            TodaysDateFormat="dd.MM.yyyy" />
                        <asp:RequiredFieldValidator ID="rfvExpertiseDate" runat="server" ErrorMessage="Моля, въведете дата на експертиза" ControlToValidate="tbExpertiseDate" ValidationGroup="vg" Display="None"></asp:RequiredFieldValidator>
                        <asp:CustomValidator ID="cvExpertiseDate" runat="server" ErrorMessage="Моля, въведете коректна дата на експертиза (Формат на дата: дд.мм.гггг)" ControlToValidate="tbExpertiseDate" ValidationGroup="vg" Display="None" OnServerValidate="cvDamageDate_ServerValidate"></asp:CustomValidator>

                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Дата на извършване на ремонта</p>
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="tbRepairDate" MaxLength="10" ToolTip="Формат на дата: дд.мм.гггг" /><asp:Button ID="bRepairDate" runat="server" Text=".." />
                        <asp:CalendarExtender ID="ceRepairDate" runat="server" TargetControlID="tbRepairDate" PopupButtonID="bRepairDate"
                            DaysModeTitleFormat="dd.MM.yyyy" FirstDayOfWeek="Monday" Format="dd.MM.yyyy"
                            TodaysDateFormat="dd.MM.yyyy" />
                        <asp:CustomValidator ID="cvRepairDate" runat="server" ErrorMessage="Моля, въведете коректна дата на извършване на ремонта (Формат на дата: дд.мм.гггг)" ControlToValidate="tbRepairDate" ValidationGroup="vg" Display="None" OnServerValidate="cvDamageDate_ServerValidate"></asp:CustomValidator>

                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <p class="lbl">Място на експертиза</p>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:CustomValidator ID="cvRegional" runat="server" Display="None" ErrorMessage="Моля, изберете Град/Село" OnServerValidate="cvRegional_ServerValidate" ValidateEmptyText="true" ValidationGroup="vg" />
                        <uc1:ucRegional runat="server" ID="ucExpertisePlace" AddNull="false" CanInsert="true" MandatoryFields="true" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">
                            <%if (this.Damage.JustHours)
                              {%>

                            Време за монтаж/демонтаж(минути)
                            <%}
                              else
                              {%>
                            Монтаж/демонтаж
                            <%} %>
                        </p>
                    </td>
                    <td>
                        <asp:DropDownList runat="server" ID="ddlDissasemblyTime" AutoPostBack="True" OnSelectedIndexChanged="ddlDissasemblyTime_SelectedIndexChanged"></asp:DropDownList>
                        <asp:DropDownList runat="server" ID="ddlDisassemblyPrice" AutoPostBack="True" OnSelectedIndexChanged="ddlDisassemblyPrice_SelectedIndexChanged"></asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Време за монтаж/демонтаж(минути) целия автомобил и цена</p>
                    </td>
                    <td>
                        <asp:Literal runat="server" ID="lTotalDissasemblyTime"></asp:Literal>
                        |
                        <asp:Literal runat="server" ID="lTotalDissasemblyTimeSum"></asp:Literal>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Видяна от експерт</p>
                    </td>
                    <td>
                        <asp:CheckBox ID="cbExpertChecked" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Подготовка</p>
                    </td>
                    <td>
                        <asp:DropDownList runat="server" ID="ddlPreparationTime" AutoPostBack="true" OnSelectedIndexChanged="ddlPreparationTime_SelectedIndexChanged" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Цена на подготовка</p>
                    </td>
                    <td>
                        <asp:Literal runat="server" ID="lPreparationPrice"></asp:Literal>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Допълнителни материали</p>
                    </td>
                    <td>
                        <asp:DropDownList runat="server" ID="ddlAdditionalMaterialsTotal" AutoPostBack="true" OnSelectedIndexChanged="ddlAdditionalMaterialsTotal_SelectedIndexChanged" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Допълнителни материали за целия автомобил</p>
                    </td>
                    <td>
                        <asp:Literal runat="server" ID="lAdditionalMaterialsWithDetails"></asp:Literal>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Цена без отстъпка</p>
                    </td>
                    <td>
                        <asp:Label runat="server" ID="lPriceNoVatNoDIscount" />
                        <asp:Button ID="bCalcPercent" runat="server" Text="%" OnClick="bCalcPercent_Click" />
                        <asp:Button ID="bCalcSum" runat="server" Text="&#931;" OnClick="bCalcSum_Click" />

                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Отстъпка %</p>
                    </td>
                    <td>
                        <asp:Label runat="server" ID="lDiscountPercent" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Отстъпка стойност</p>
                    </td>
                    <td>
                        <asp:Label runat="server" ID="lDiscountPrice" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Цена с отстъпка</p>
                    </td>
                    <td>
                        <asp:Label runat="server" ID="lPriceNoVatDIscount" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">ДДС</p>
                    </td>
                    <td>
                        <asp:Label runat="server" ID="lVat" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Крайна цена</p>
                    </td>
                    <td>
                        <asp:Label runat="server" ID="lTotal" />
                    </td>
                </tr>
            </table>
            <br />
            <asp:CustomValidator runat="server" ID="cvDamageDetails" ErrorMessage="Моля, въведете поне една щета" ValidationGroup="vg" Display="None" OnServerValidate="cvDamageDetails_ServerValidate" />
            <asp:Repeater runat="server" ID="rDamageDetails" OnItemCommand="rDamageDetails_ItemCommand">
                <HeaderTemplate>
                    <table border="1" cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                <p class="lbl">No</p>
                            </td>
                            <td>
                                <p class="lbl">Елемент</p>
                            </td>
                            <% if (!JustHoursSelected())
                               {%>
                            <td>
                                <p class="lbl">До 20 мм</p>
                            </td>
                            <td>
                                <p class="lbl">До 30 мм</p>
                            </td>
                            <td>
                                <p class="lbl">До 40 мм</p>
                            </td>
                            <td>
                                <p class="lbl">До 50 мм</p>
                            </td>
                            <%}
                               else
                               {%>

                            <td>
                                <p class="lbl">Минути за работа</p>
                            </td>
                            <%} %>
                            <td>
                                <p class="lbl">С резерви</p>
                            </td>
                            <td>
                                <p class="lbl">ALU</p>
                            </td>

                            <td>
                                <p class="lbl">
                                    <%if (this.Damage.JustHours)
                                      {%>

                            Време за монтаж/демонтаж(минути)
                            <%}
                                      else
                                      {%>
                            Монтаж/демонтаж
                            <%} %>
                                </p>
                            </td>

                            <td>
                                <p class="lbl">PNP</p>
                            </td>

                            <td>
                                <p class="lbl">Полиране</p>
                            </td>
                            <td>
                                <p class="lbl">Традиционен метод</p>
                            </td>
                            <td>
                                <p class="lbl">Цена</p>
                            </td>

                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td>
                            <%# Container.ItemIndex+1 %>
                        </td>
                        <td>
                            <asp:LinkButton runat="server" ID="lbEdit" CommandName="EDIT" CommandArgument='<%#Eval("DetailKindId") %>' Text='<%#Eval("DetailName") %>' />
                        </td>
                        <% if (!JustHoursSelected())
                           {%>
                        <td>
                            <%#Eval("Size1") %>
                        </td>
                        <td>
                            <%#Eval("Size2") %>
                        </td>
                        <td>
                            <%#Eval("Size3") %>
                        </td>
                        <td>
                            <%#Eval("Size4") %>
                        </td>
                        <%}
                           else
                           {%>
                        <td>
                            <%#Eval("Minutes") %>
                        </td>
                        <%} %>
                        <td>
                            <%#Eval("WithReserve").ToString()==true.ToString()?"Да":"Не" %>
                        </td>
                        <td>
                            <%#Eval("ALU").ToString()==true.ToString()?"Да":"Не" %>                            
                        </td>
                        <td>
                            <%#Eval("DisassemblyTime") %>
                        </td>

                        <td>
                            <%#Eval("PNP").ToString()==true.ToString()?"Да":"Не" %>
                        </td>

                        <td>
                            <%#Eval("Polish").ToString()==true.ToString()?"Да":"Не" %>
                        </td>
                        <td>
                            <%#Eval("Traditional").ToString()==true.ToString()?"Да":"Не" %>
                        </td>

                        <td>
                            <%#Decimal.Parse(Eval("Price").ToString()).ToString("0.00") %>
                        </td>

                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    </table>
                </FooterTemplate>
            </asp:Repeater>
        </asp:View>
        <asp:View runat="server" ID="vElement">
            <asp:Label runat="server" ID="lDetailName" CssClass="lbl" />
            <br />
            <asp:Image ID="imgDetail" runat="server" ImageUrl="" />
            <br />


            <table border="1" cellpadding="0" cellspacing="0">
                <% if (ddlSize1.Visible)
                   {%>
                <caption>
                    &gt;
                    <tr>
                        <td>
                            <p class="lbl">
                                До 20 мм
                            </p>
                        </td>
                        <td>
                            <asp:DropDownList runat="server" ID="ddlSize1"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <p class="lbl">
                                До 30 мм
                            </p>
                        </td>
                        <td>
                            <asp:DropDownList runat="server" ID="ddlSize2"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <p class="lbl">
                                До 40 мм
                            </p>
                        </td>
                        <td>
                            <asp:DropDownList runat="server" ID="ddlSize3"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <p class="lbl">
                                До 50 мм
                            </p>
                        </td>
                        <td>
                            <asp:DropDownList runat="server" ID="ddlSize4"></asp:DropDownList>
                        </td>
                    </tr>
                    <%
                   }
                   else
                   { 
                    %>
                    <tr>
                        <td>
                            <p class="lbl">
                                Минути работа
                            </p>
                        </td>
                        <td>
                            <asp:TextBox ID="tbMinutes" runat="server" CssClass="input100" Text="0" />
                            <asp:FilteredTextBoxExtender ID="FilteredTextBoxExtender7" runat="server" FilterType="Numbers" TargetControlID="tbMinutes" />
                        </td>
                    </tr>
                    <%} %>
                    <tr>
                        <td>
                            <p class="lbl">
                                ALU
                            </p>
                        </td>
                        <td>
                            <asp:CheckBox ID="cbALU" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <p class="lbl">
                                Време за разглобяване(минути)
                            </p>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlDissasemblyTimeDetail" runat="server">
                            </asp:DropDownList>
                            <asp:DropDownList runat="server" ID="ddlDisassemblyPriceDetail"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <p class="lbl">
                                Допълнителни материали
                            </p>
                        </td>
                        <td>
                            <asp:DropDownList runat="server" ID="ddlAdditionalMaterials" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <p class="lbl">
                                PNP
                            </p>
                        </td>
                        <td>
                            <asp:CheckBox ID="cbPNP" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <p class="lbl">
                                Полиране
                            </p>
                        </td>
                        <td>
                            <asp:CheckBox ID="cbPolish" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <p class="lbl">
                                Традиционен метод
                            </p>
                        </td>
                        <td>
                            <asp:CheckBox ID="cbTraditional" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <p class="lbl">
                                С резерви
                            </p>
                        </td>
                        <td>
                            <asp:CheckBox ID="cbWithReserve" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <p class="lbl">
                                <a onclick="ShowHideObs()" href="#">Наблюдение</a>
                            </p>
                        </td>
                        <td>
                            <div id="dObs" style="display: none;">
                                <asp:CheckBoxList ID="cblObs" runat="server" RepeatColumns="3">
                                    <asp:ListItem Text="BR Изгорено" Value="BR" />
                                    <asp:ListItem Text="CA Счупено" Value="CA" />
                                    <asp:ListItem Text="CD Срязано" Value="CD" />
                                    <asp:ListItem Text="CR Пукната гума" Value="CR" />
                                    <asp:ListItem Text="DE Разлепено/Лошо фиксирано" Value="DE" />
                                    <asp:ListItem Text="DM Дефект" Value="DM" />
                                    <asp:ListItem Text="DP Дефект - боя" Value="DP" />
                                    <asp:ListItem Text="EC Отлюспена боя" Value="EC" />
                                    <asp:ListItem Text="EN Натиснато" Value="EN" />
                                    <asp:ListItem Text="FE Пукнато" Value="FE" />
                                    <asp:ListItem Text="FR Надраскано/малко/" Value="FR" />
                                    <asp:ListItem Text="MA Липсва" Value="MA" />
                                    <asp:ListItem Text="NF Лошо или не функционира" Value="NF" />
                                    <asp:ListItem Text="PI Пик" Value="PI" />
                                    <asp:ListItem Text="RE Раирано/Надраскано" Value="RE" />
                                    <asp:ListItem Text="RO Ръжда" Value="RO" />
                                    <asp:ListItem Text="TA Петно" Value="TA" />
                                    <asp:ListItem Text="PR Замърсено от външен фактор" Value="PR" />
                                    <asp:ListItem Text="RC" Value="RC" />
                                    <asp:ListItem Text="NC Заменена част" Value="NC" />
                                </asp:CheckBoxList>
                            </div>
                        </td>
                    </tr>
                </caption>
            </table>
            <asp:Button runat="server" ID="bPhotos" Text="Снимки" OnClick="bPhotos_Click" />
            <asp:Button ID="bSaveDetail" runat="server" OnClick="bSaveDetail_Click" Text="Запис" />
            <asp:Button ID="bCancelDetail" runat="server" OnClick="bCancelDetail_Click" Text="Отказ" />
            <asp:UpdatePanel runat="server" ID="upRecalc" OnLoad="upRecalc_Load">
                <ContentTemplate>
                    Цена на детайла:<asp:Label runat="server" ID="lDetailPrice" /><asp:Button runat="server" ID="bRecalc" Text="Преизчисли" OnClick="bRecalc_Click" />
                </ContentTemplate>
            </asp:UpdatePanel>

        </asp:View>
        <asp:View runat="server" ID="vSettings">

            <table border="1" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <p class="lbl">Вид отстъпка</p>
                    </td>
                    <td>Като крайна сума
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Отстъпка</p>
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="tbDiscount" CssClass="input100" Text="0" />
                        <asp:FilteredTextBoxExtender ID="FilteredTextBoxExtender5" runat="server" TargetControlID="tbDiscount"
                            FilterType="Numbers" />
                    </td>
                </tr>
            </table>
            <asp:Button runat="server" ID="bSaveDiscount" Text="Запис" OnClick="bSaveDiscount_Click" />
            <asp:Button runat="server" ID="bCancelDiscount" Text="Отказ" OnClick="bCancelDiscount_Click" />

        </asp:View>
        <asp:View runat="server" ID="vSettings2">

            <table border="1" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <p class="lbl">Вид отстъпка</p>
                    </td>
                    <td>Като процент
                        
                    </td>
                </tr>
                <tr>
                    <td>
                        <p class="lbl">Отстъпка</p>
                    </td>
                    <td>
                        <asp:DropDownList runat="server" ID="ddlDiscountPercent">
                        </asp:DropDownList>
                    </td>
                </tr>
            </table>
            <asp:Button runat="server" ID="bSaveDiscount2" Text="Запис" OnClick="bSaveDiscount2_Click" />
            <asp:Button runat="server" ID="bCancelDiscount2" Text="Отказ" OnClick="bCancelDiscount2_Click" />

        </asp:View>
        <asp:View runat="server" ID="vImages">
            <asp:FileUpload ID="fuPhoto" runat="server" />
            <asp:Button runat="server" ID="bUploadPhoto" Text="Зареди" OnClick="bUploadPhoto_Click" />
            <asp:Button runat="server" ID="bClose" Text="Обратно към програмата" OnClick="bClose_Click" />
            <asp:Repeater runat="server" ID="rPhotos" OnItemCommand="rPhotos_ItemCommand">
                <HeaderTemplate>
                    <table>
                </HeaderTemplate>
                <FooterTemplate>
                    </table>
                </FooterTemplate>
                <ItemTemplate>
                    <tr>
                        <td>
                            <img src='Handlers/fImage.aspx?imgId=<%#Eval("PhotoId") %>' style="max-width: 300px; max-height: 200px" alt="" />
                        </td>
                        <td valign="top">
                            <asp:LinkButton runat="server" ID="lbDelPhoto" CommandName="DELPHOTO" CommandArgument='<%#Eval("PhotoId") %>' Text="Изтрий" />
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:Repeater>


        </asp:View>
    </asp:MultiView>


</asp:Content>
